
from operation.models import Collect,Buy
from django.template import Library
register = Library()
@register.filter
def has_collection(course,user):
    collected = Collect.objects.filter(user = user,course=course,)
    return True if collected else False

@register.filter
def has_buy_order(course,user):
    buy_order = Buy.objects.filter(user = user,course=course,status = False)
    return True if buy_order else False